 |
 |
 |
 |
#271473 - 03/26/04 04:37 AM
Finished-[6.3] Display Attachment Filename + Filesize
|
Code Monkey
Registered: 09/26/03
Posts: 524
|
Mod Name / Version: Display Attachment Filename + Filesize <br /> <br /> Description: This mod will display the filename of an attachment as part of the attachment link (minus the attachment number) and display its filesize in kilobytes. <br /> <br />Its primary purpose is to allow your visitors to know which type of file they will be downloading beforehand, as well as know how large it is (in case they are on dial-up and have no interest in downloading something excessively large). <br /> <br />(I'm not sure whether this mod works in other versions besides 6.3) <br /> <br />DEMO <br />==== <br /> <br /> http://www.mameworld.info/ubbthreads/sho...5b43dab728d49f4 <br /> <br /> <br /> Working Under: UBB.Threads 6.3 <br /> <br /> Mod Status: Finished <br /> <br /> Any pre-requisites: <br /> <br /> Author(s): Twisty <br /> <br /> Date: 03/25/04 <br /> <br /> Credits: <br /> <br /> Files Altered: <br />showthreaded.php <br />showflat.php <br /> <br /> New Files: <br /> <br /> Database Altered: no <br /> <br /> Info/Instructions: <br /> <br />1) In showthreaded.php... <br /> <br />CHANGE THIS: <br /> <br /> if ($File) { <br /> $File = rawurlencode($File); <br /> if (!$downloads) {$downloads = 0; } <br /> $filelink = "<a href=\"{$config['phpurl']}/download.php?Number=$Number\">{$ubbt_lang['FILE_ATTACH']}</a> ($downloads {$ubbt_lang['DOWNLOADS']})<br />"; <br /> } <br />TO THIS: <br /> <br /> if (($File) && (strlen($File) < 100)){ <br /> $File = rawurlencode($File); <br /> $Filecut = eregi_replace("^([0-9]+)-","",$File); <br /> $Filecut = eregi_replace("%20"," ",$Filecut); <br /> $Filecut = eregi_replace("%5C%27","'",$Filecut); <br /> $Filecut = eregi_replace("%21","!",$Filecut); <br /> $Filecut = eregi_replace("%40","@",$Filecut); <br /> $Filecut = eregi_replace("%23","#",$Filecut); <br /> $Filecut = eregi_replace("%24","$",$Filecut); <br /> $Filecut = eregi_replace("%25","%",$Filecut); <br /> $Filecut = eregi_replace("%5E","^",$Filecut); <br /> $Filecut = eregi_replace("%26","&",$Filecut); <br /> $Filecut = eregi_replace("%28","(",$Filecut); <br /> $Filecut = eregi_replace("%29",")",$Filecut); <br /> $Filecut = eregi_replace("%5B","[",$Filecut); <br /> $Filecut = eregi_replace("%5D","]",$Filecut); <br /> $Filecut = eregi_replace("%7B","{",$Filecut); <br /> $Filecut = eregi_replace("%7D","}",$Filecut); <br /> $Filecut = eregi_replace("%60","`",$Filecut); <br /> $Filecut = eregi_replace("%2B","+",$Filecut); <br /> $Filecut = eregi_replace("%3D","=",$Filecut); <br /> $Filecut = eregi_replace("%7E","~",$Filecut); <br /> $Filecut = eregi_replace("%3B",";",$Filecut); <br /> $Filecut = eregi_replace("%A3","£",$Filecut); <br /> $Filecut = eregi_replace("%80","€",$Filecut); <br /> $Filecut = eregi_replace("%A5","¥",$Filecut); <br /> $Filecut = eregi_replace("%A7","§",$Filecut); <br /> $Filecut = eregi_replace("%A2","¢",$Filecut); <br /> $Filecut = eregi_replace("%2C",",",$Filecut); <br /> $attachpath="{$config['files']}/$File"; <br /> $attachpath= eregi_replace("%20"," ",$attachpath); <br /> $attachpath= eregi_replace("%5C%27","\'",$attachpath); <br /> $attachpath= eregi_replace("%21","!",$attachpath); <br /> $attachpath= eregi_replace("%40","@",$attachpath); <br /> $attachpath= eregi_replace("%23","#",$attachpath); <br /> $attachpath= eregi_replace("%24","$",$attachpath); <br /> $attachpath= eregi_replace("%25","%",$attachpath); <br /> $attachpath= eregi_replace("%5E","^",$attachpath); <br /> $attachpath= eregi_replace("%26","&",$attachpath); <br /> $attachpath= eregi_replace("%28","(",$attachpath); <br /> $attachpath= eregi_replace("%29",")",$attachpath); <br /> $attachpath= eregi_replace("%5B","[",$attachpath); <br /> $attachpath= eregi_replace("%5D","]",$attachpath); <br /> $attachpath= eregi_replace("%7B","{",$attachpath); <br /> $attachpath= eregi_replace("%7D","}",$attachpath); <br /> $attachpath= eregi_replace("%60","`",$attachpath); <br /> $attachpath= eregi_replace("%2B","+",$attachpath); <br /> $attachpath= eregi_replace("%3D","=",$attachpath); <br /> $attachpath= eregi_replace("%7E","~",$attachpath); <br /> $attachpath= eregi_replace("%3B",";",$attachpath); <br /> $attachpath= eregi_replace("%A3","£",$attachpath); <br /> $attachpath= eregi_replace("%80","€",$attachpath); <br /> $attachpath= eregi_replace("%A5","¥",$attachpath); <br /> $attachpath= eregi_replace("%A7","§",$attachpath); <br /> $attachpath= eregi_replace("%A2","¢",$attachpath); <br /> $attachpath= eregi_replace("%2C",",",$attachpath); <br /> $attachfilesize = filesize($attachpath); <br /> $kbattachfilesize = $attachfilesize/1024; <br /> $finalattachfilesize = round($kbattachfilesize); <br /> if (!$downloads) {$downloads = 0; } <br /> $filelink = "<a href=\"{$config['phpurl']}/download.php?Number=$Number\">{$ubbt_lang['FILE_ATTACH']}: $Filecut</a> $finalattachfilesize KB ($downloads {$ubbt_lang['DOWNLOADS']})"; <br /> } <br /> <br /> <br />2) In showflat.php... <br /> <br />CHANGE THIS: <br /> <br /> if ($File) { <br /> $File = rawurlencode($File); <br /> if (!$downloads) { $downloads = "0"; } <br /> $postrow[$i]['filelink'] = "<a href=\"{$config['phpurl']}/download.php?Number=$Number\">{$ubbt_lang['FILE_ATTACH']}</a> ($downloads {$ubbt_lang['DOWNLOADS']})"; <br /> } <br />TO THIS: <br /> <br /> if (($File) && (strlen($File) < 100)){ <br /> $File = rawurlencode($File); <br /> $Filecut = eregi_replace("^([0-9]+)-","",$File); <br /> $Filecut = eregi_replace("%20"," ",$Filecut); <br /> $Filecut = eregi_replace("%5C%27","'",$Filecut); <br /> $Filecut = eregi_replace("%21","!",$Filecut); <br /> $Filecut = eregi_replace("%40","@",$Filecut); <br /> $Filecut = eregi_replace("%23","#",$Filecut); <br /> $Filecut = eregi_replace("%24","$",$Filecut); <br /> $Filecut = eregi_replace("%25","%",$Filecut); <br /> $Filecut = eregi_replace("%5E","^",$Filecut); <br /> $Filecut = eregi_replace("%26","&",$Filecut); <br /> $Filecut = eregi_replace("%28","(",$Filecut); <br /> $Filecut = eregi_replace("%29",")",$Filecut); <br /> $Filecut = eregi_replace("%5B","[",$Filecut); <br /> $Filecut = eregi_replace("%5D","]",$Filecut); <br /> $Filecut = eregi_replace("%7B","{",$Filecut); <br /> $Filecut = eregi_replace("%7D","}",$Filecut); <br /> $Filecut = eregi_replace("%60","`",$Filecut); <br /> $Filecut = eregi_replace("%2B","+",$Filecut); <br /> $Filecut = eregi_replace("%3D","=",$Filecut); <br /> $Filecut = eregi_replace("%7E","~",$Filecut); <br /> $Filecut = eregi_replace("%3B",";",$Filecut); <br /> $Filecut = eregi_replace("%A3","£",$Filecut); <br /> $Filecut = eregi_replace("%80","€",$Filecut); <br /> $Filecut = eregi_replace("%A5","¥",$Filecut); <br /> $Filecut = eregi_replace("%A7","§",$Filecut); <br /> $Filecut = eregi_replace("%A2","¢",$Filecut); <br /> $Filecut = eregi_replace("%2C",",",$Filecut); <br /> $attachpath="{$config['files']}/$File"; <br /> $attachpath= eregi_replace("%20"," ",$attachpath); <br /> $attachpath= eregi_replace("%5C%27","\'",$attachpath); <br /> $attachpath= eregi_replace("%21","!",$attachpath); <br /> $attachpath= eregi_replace("%40","@",$attachpath); <br /> $attachpath= eregi_replace("%23","#",$attachpath); <br /> $attachpath= eregi_replace("%24","$",$attachpath); <br /> $attachpath= eregi_replace("%25","%",$attachpath); <br /> $attachpath= eregi_replace("%5E","^",$attachpath); <br /> $attachpath= eregi_replace("%26","&",$attachpath); <br /> $attachpath= eregi_replace("%28","(",$attachpath); <br /> $attachpath= eregi_replace("%29",")",$attachpath); <br /> $attachpath= eregi_replace("%5B","[",$attachpath); <br /> $attachpath= eregi_replace("%5D","]",$attachpath); <br /> $attachpath= eregi_replace("%7B","{",$attachpath); <br /> $attachpath= eregi_replace("%7D","}",$attachpath); <br /> $attachpath= eregi_replace("%60","`",$attachpath); <br /> $attachpath= eregi_replace("%2B","+",$attachpath); <br /> $attachpath= eregi_replace("%3D","=",$attachpath); <br /> $attachpath= eregi_replace("%7E","~",$attachpath); <br /> $attachpath= eregi_replace("%3B",";",$attachpath); <br /> $attachpath= eregi_replace("%A3","£",$attachpath); <br /> $attachpath= eregi_replace("%80","€",$attachpath); <br /> $attachpath= eregi_replace("%A5","¥",$attachpath); <br /> $attachpath= eregi_replace("%A7","§",$attachpath); <br /> $attachpath= eregi_replace("%A2","¢",$attachpath); <br /> $attachpath= eregi_replace("%2C",",",$attachpath); <br /> $attachfilesize = filesize($attachpath); <br /> $kbattachfilesize = $attachfilesize/1024; <br /> $finalattachfilesize = round($kbattachfilesize); <br /> if (!$downloads) {$downloads = 0; } <br /> $postrow[$i]['filelink'] = "<a href=\"{$config['phpurl']}/download.php?Number=$Number\">{$ubbt_lang['FILE_ATTACH']}: $Filecut</a> $finalattachfilesize KB ($downloads {$ubbt_lang['DOWNLOADS']})"; <br /> } <br /> <br />:-) <br /> <br /> Disclaimer: Please backup every file that you intend to modify. <br />If the modification modifies the database, it's a good idea to backup your database before doing so. <br /> <br />Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.
|
|
Top
|
|
|
|
 |
 |
 |
 |
|
|